package com.achievo.know.application.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.achievo.know.application.SyncLogApplication;
import com.achievo.know.domain.SyncLog;
import com.achievo.know.domain.SyncLogRepository;
import com.dayatang.querychannel.service.QueryChannelService;
import com.dayatang.querychannel.support.Page;

@Service
public class SyncLogApplicationImpl implements SyncLogApplication {

	@Autowired
	private SyncLogRepository syncLogRepository;
	
	@Autowired
	private QueryChannelService queryChannel;
	

	public QueryChannelService getQueryChannel() {
		return queryChannel;
	}

	public void setQueryChannel(QueryChannelService queryChannel) {
		this.queryChannel = queryChannel;
	}

	public SyncLogRepository getSyncLogRepository() {
		return syncLogRepository;
	}

	public void setSyncLogRepository(SyncLogRepository syncLogRepository) {
		this.syncLogRepository = syncLogRepository;
	}

	@Override
	public void save(SyncLog log) {
		syncLogRepository.save(log);
	}

	@Override
	public Page<SyncLog> queryPage(int currentPage, int pageSize) {
		String hql = "from SyncLog r order by r.syncTime desc  ";
		Object[] params = new Object[] {};
		return queryChannel.queryPagedResultByPageNo(hql, params, currentPage,
				pageSize);
	}
	
	
	
}
